//
//  CWJavaScriptApiWidget.m
//  CWDevelop
//
//  Created by LittoCats on 7/16/14.
//  Copyright (c) 2014 Littocats. All rights reserved.
//

#import "CWJavaScriptApiWidget.h"

#define PAGEID action[@"page"]
#define PAGE action[@"__PAGEID"]
#define WIDGETID action[@"widget"]
#define WIDGET action[@"__WIDGET"]

@implementation CWJavaScriptApiWidget

+ (void)analyseAction:(NSMutableDictionary *)action
{
    [super analyseAction:action];
    
    NSString *widgetId = !WIDGETID || [WIDGETID isEmpty] ? [PAGE view]._id : WIDGETID;
    if (!widgetId){
        CWLog(@"[CWJavaScriptAPI] warning : \
              Page.id is not exist < domain : view >.");
    }else{
        UIView *widgetInstance = [NSObject findInstanceWithId:WIDGETID];
        widgetInstance ? [action setObject:widgetInstance forKey:@"__WIDGET"] : nil;
    }
}

#pragma mark-
CWJavascriptApi(onItemClick)
{
    
}
@end
